﻿@using MvcRags.Examples.Models
@using MvcRags.Filtering
@using MvcRags.Pagination
@using MvcRags.Sorting
@model IEnumerable<MvcRags.Examples.Models.Customer>

@using (Html.BeginFilterForm())
{
<div class="input-append">
    @Html.FilterDropDownForModel()
    @Html.DropDownList("filterMode", new SelectList(new[]
        {
            new { Text = "Contains", Value = "1" },
            new { Text = "Starts With", Value = "2" }
        }, "Value", "Text", ViewBag.SelectedFilterMode))
    @Html.FilterTextboxForModel()
    <button type="submit" class="btn"><i class="icon-search"></i></button>
    <a href="/Filtering" class="btn"><i class="icon-remove"></i></a>
</div>
}

<table class="table table-bordered">
    <thead>
        <tr>
            <th>@Html.SortLinkFor(model => model.Id)</th>
            <th>@Html.SortLinkFor(model => model.Name)</th>
            <th>@Html.SortLinkFor(model => model.Country)</th>
            <th>@Html.SortLinkFor(model => model.Mail)</th>
            <th>@Html.SortLinkFor(model => model.Pvn)</th>
            <th>@Html.SortLinkFor(model => model.CreatedAt)</th>
        </tr>
    </thead>
    <tbody>
        @foreach (Customer item in Model)
        {
            <tr>
                <td>@item.Id</td>
                <td>@item.Name</td>
                <td>@item.Country</td>
                <td>@item.Mail</td>
                <td>@item.Pvn</td>
                <td>@item.CreatedAt</td>
            </tr>
        }
    </tbody>
</table>

<div>
    <div class="span8">
        <div class="pagination">
            @Html.PageSelectPanel()
        </div>
    </div>

    <div class="span4">
        <div style="margin: 20px 0">
            <div class="btn-toolbar pull-right" style="margin: 0">
                <div class="btn-group">
                    <button class="btn dropdown-toggle" data-toggle="dropdown">
                        @ViewBag.PageEntries
                        <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu">
                        <li>@Html.PageSizeSetLink("10", 10)</li>
                        <li>@Html.PageSizeSetLink("15", 15)</li>
                        <li>@Html.PageSizeSetLink("25", 25)</li>
                        <li>@Html.PageSizeSetLink("50", 50)</li>
                        <li>@Html.PageSizeSetLink("100", 100)</li>
                    </ul>
                </div>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
</div>

<div class="span12">
    <div class="pagination" style="text-align: center">
        <span><b>@ViewData[PaginationSettings.ViewDataKeyPageEntries]</b> Customers out of <b>@ViewData[PaginationSettings.ViewDataKeyTotalEntriesCount]</b></span> |
        <span>Page <b>@ViewData[PaginationSettings.ViewDataKeyPage]</b> of <b>@ViewData[PaginationSettings.ViewDataKeyPageCount]</b></span>
    </div>
</div>